package com.cws4cloud.cws.mall.xsm.controller;

import com.cws4cloud.cws.common.core.util.R;
import com.cws4cloud.cws.mall.xsm.service.XsmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: XsmRestController
 * @Description: 新商盟接口管理
 * @Date 2021/6/20 16:35
 */
@RequestMapping("/xsm")
@RestController
@Api(value = "xsm", tags = "新商盟接口管理")
public class XsmRestController {

	@Autowired
	private XsmService xsmService;

	/**
	 * 新商盟获取验证码接口
	 * @param securityID
	 */
	@PostMapping("/verifyCode")
	@ApiOperation(value = "获取验证码", notes = "获取验证码")
	public R verifyCode(@RequestParam("securityID") String securityID){
		return R.ok(xsmService.verifyCode(securityID));
	}

	/**
	 * 新商盟登录接口
	 * @param securityID
	 * @param username
	 * @param password
	 * @param valcode
	 * @return
	 */
	@PostMapping("/login")
	@ApiOperation(value = "登录", notes = "登录")
	public R login(@RequestParam("securityID") String securityID,
				   @RequestParam("username") String username,
				   @RequestParam("password") String password,
				   @RequestParam("valcode") String valcode) {
		return R.ok(xsmService.login(securityID,username,password,valcode));
	}
}
